      Function Base64ToImage(ByVal base64string As String) As System.Drawing.Image
      'Setup image and get data stream together
      Dim img As System.Drawing.Image
      Dim MS As System.IO.MemoryStream = New System.IO.MemoryStream
      Dim b64 As String = base64string.Replace(" ", "+")
      Dim b() As Byte

      'Converts the base64 encoded msg to image data
      b = Convert.FromBase64String(b64)
      MS = New System.IO.MemoryStream(b)

      'creates image
      img = System.Drawing.Image.FromStream(MS)

      Return img
      End Function